//引入 request 文件
import request from '@/util/request.js'

export const userId = uni.getStorageSync("UserId");

//获取文章下的评论
export const getComments = (articleId) => {
	if (!articleId) {
	    throw new Error('articleId 不能为空');
	  }
	return request({
	        url: `/api/comments/list/${articleId}`,
	        method: 'get'
	})
};

// 发送评论
export const createComment = (commentsParam) => {
    return request({
        url: '/api/comments/create',
        method: 'post',
        data: commentsParam
    })
}


// 回复
export const createReply = (repliesParam) => {
    return request({
        url: '/api/replies/create',
        method: 'post',
        data: repliesParam
    })
}

//创建点赞
export const createLikes = (commentId,userId) => {
	return request({
		url: `/api/Likes/create/${commentId}/${userId}`,
		method: 'post'
	})
}

//删除点赞
export const deleteLikes = (commentId,userId) => {
	return request({
		url: `/api/Likes/delete/${commentId}/${userId}`,
		method: 'delete',
	})
}





